package com.jianyu.java;

public class operator {
    public static void main(String[] args) {
        int ia = 6;
        int ib = 2;
        System.out.println(ia + ib);
        System.out.println(ia - ib);
        System.out.println(ia * ib);
        System.out.println(ia / ib);
        System.out.println(5 / 2); // 2
        System.out.println(5 % 2);
        System.out.println(ia++);//6
        System.out.println(ia);//7
        ia = 6;
        System.out.println(++ia);//7
        System.out.println(ia);//7
        ia = 6;
        System.out.println(ia--);//6
        System.out.println(ia);//5
        ia = 6;
        System.out.println(--ia);//5
        System.out.println(ia);//5
        System.out.println((double) 5 / 2);   // 2.5
        System.out.println(5 / (double) 2);
        System.out.println((double) (5 / 2));//2.0
        System.out.println(5 * 1.0 / 2);

        System.out.println(5 / 0.0);
        System.out.println(0 / 0.0);

        System.out.println(4 != 3);
        System.out.println(3 == 3);

        System.out.println(4 > 3);
        System.out.println(4 >= 3);

        System.out.println(4 < 3);
        System.out.println(4 <= 3);

        boolean a = true;
        boolean b = false;
        System.out.println(a&b);
        System.out.println(a&&b);
        System.out.println(a|b);
        System.out.println(a||b);
        System.out.println(!a);
        System.out.println(a^b);

        System.out.println(8<<1);
        System.out.println(8>>1);
        System.out.println(8>>>1);
        System.out.println(8&1);
        System.out.println(8|1);
        System.out.println(8^1);
        System.out.println(~8);

        int c=1;
        System.out.println(c > 3 ? c : 3);
        System.out.println(c < 3 ? c : 3);


    }
}
